- add_to_breadcrumbs _("Branches"), project_branches_path(@project)
- page_title _("New branch")
- default_ref = params[:ref] || @project.default_branch

- if @error
  = render Pajamas::AlertComponent.new(variant: :danger) do |c|
    - c.with_body do
      = @error
= render ::Layouts::PageHeadingComponent.new(_('New branch'))

= form_tag namespace_project_branches_path, method: :post, id: "new-branch-form", class: "js-create-branch-form" do
  .form-group.gl-max-w-80
    = label_tag :branch_name, _('Branch name')
    = text_field_tag :branch_name, params[:branch_name], required: true, autofocus: true, class: 'form-control js-branch-name monospace'
    .form-text.gl-text-danger.js-branch-name-error{ 'aria-live': 'assertive' }
  .form-group.gl-max-w-80
    = label_tag :ref, _('Create from')
    .js-new-branch-ref-selector{ data: { project_id: @project.id, default_branch_name: default_ref, hidden_input_name: 'ref' } }
    .form-text.gl-text-subtle
      = _('Existing branch name, tag, or commit SHA')
  = render Pajamas::ButtonComponent.new(variant: :confirm, button_options: { type: 'submit', class: 'gl-mr-3' }) do
    = _('Create branch')
  = link_button_to _('Cancel'), project_branches_path(@project)
